package com.mhs.tracuu;

import com.mhs.mhs_gui.R;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class IconicAdapter extends ArrayAdapter 
{
    Activity context;
    String[] items;
    int layoutId;

	IconicAdapter(Activity context, String[] items, int layoutid) 
	{
		super(context, layoutid, items);
		this.context = context;
		this.items = items;
		this.layoutId = layoutid;
	}

	public View getView(int position, View convertView, ViewGroup parent) 
	{
		LayoutInflater inflater = context.getLayoutInflater();
		View row = inflater.inflate(layoutId, null);
		TextView label = (TextView) row.findViewById(R.id.label);
		ImageView icon = (ImageView) row.findViewById(R.id.image1);
		label.setText(items[position]);

		if (items[position].length() > 4) 
			icon.setImageResource(R.drawable.right_arrow);
		else
			icon.setImageResource(R.drawable.right_arrow);
		return (row);
	}//getView

}//IconicAdapter